package wechat.response.business.event.message;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import wechat.bean.response.event.message.SubscribeEventBean;
import wechat.bean.response.message.receive.ReceiveTextBean;
import wechat.resources.AppFilter;
import wechat.resources.InstanceResource;

public class ReceiveTextBusiness {
	private Logger log = LoggerFactory.getLogger(ReceiveTextBusiness.class);
	
	private ReceiveTextBean receiveTextBean;
	private InstanceResource instanceResource;
	
	public ReceiveTextBusiness(ReceiveTextBean receiveTextBean){
		this.receiveTextBean = receiveTextBean;
	}
	
	public ReceiveTextBusiness(String appid,ReceiveTextBean receiveTextBean){
		if (appid != null) {
			instanceResource = AppFilter.chooseApp(appid);
		}
		this.receiveTextBean = receiveTextBean;
	}
	
	public ReceiveTextBusiness(String str) throws Exception{
		this.receiveTextBean = new ReceiveTextBean(str);
		this.receiveTextBean.transform();
	}
	
	public ReceiveTextBusiness(String appid,String str) throws Exception{
		if (appid != null) {
			instanceResource = AppFilter.chooseApp(appid);
		}
		this.receiveTextBean = new ReceiveTextBean(str);
		this.receiveTextBean.transform();
	}
	
	public ReceiveTextBusiness(InstanceResource instanceResource,String str) throws Exception{
		this.instanceResource = instanceResource;
		this.receiveTextBean = new ReceiveTextBean(str);
		this.receiveTextBean.transform();
	}
	

	public InstanceResource getInstanceResource() {
		return instanceResource;
	}
}
